<!DOCTYPE html>
<html lang='zh-CN'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover'>
    <title>标题</title>
</head>

<body>
    <div>
        <button class="button-main" onclick="clickBtn1()">触发父级alert</button>
        <button onclick="clickBtn1()">触发父级路由</button>
        <a data-value="gogogo" data-src="http://www.baidu.com" onclick="clickBtn1(event)">src = baidu</a>
    </div>
    <script>
        function clickBtn1(e=1) {
            if(e)console.log(e.target.dataset.src);window.parent["myid"](e.target.dataset.src);
            return false;
        }
    </script>
</body>

</html>

<!-- <!DOCTYPE html>
<html lang='zh-CN'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover'>
    <title>标题</title>
</head>

<body>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
        $(document).ready(function () {

            function getPosition(callback) {
                if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function (position) {
                        latitude = position.coords.latitude; // 获取纬度
                        longitude = position.coords.longitude; // 获取经度
                        //alert(latitude + " " + longitude)
                        callback(latitude, longitude); //回调函数传入经度纬度
                    });
                } else {
                    alert("不支持定位功能");
                }
            }

            getPosition(function (x, y) {
                alert(x + " " + y);
                document.write(x + " & " + y);
            })

            //getPosition();
        })
    </script>

</body>

</html> -->